package domain.itf;

import util.DAOException;
import util.VersionException;
import domain.Contact;
import domain.PhoneNumber;

public interface IDAOPhoneNumber {
	
	/**
	 * Get an {@link PhoneNumber} by id.
	 * @param id
	 * @return the {@link PhoneNumber} corresponding with this id.
	 * @throws {@link DAOException}
	 */
	public PhoneNumber getByIdDB(int id) throws DAOException;
	
	/**
	 * Add a new {@link PhoneNumber}.
	 * @param phone
	 * @return
	 * @throws {@link DAOException}
	 */
	public PhoneNumber addPhoneNumberDB(PhoneNumber phone) throws DAOException;

	/**
	 * Add a new {@link PhoneNumber}.
	 * @param phoneKind
	 * @param phoneNumber
	 * @param contact
	 * @return the {@link PhoneNumber} created in database.
	 * @throws {@link DAOException}
	 */
	public PhoneNumber addPhoneNumber(String phoneKind, String phoneNumber,
			Contact contact) throws DAOException;

	/**
	 * Update a {@link PhoneNumber}.
	 * @param phoneNumber
	 * @return
	 * @throws {@link DAOException}
	 * @throws {@link VersionException}
	 */
	public PhoneNumber updatePhoneNumberDB(PhoneNumber phoneNumber) throws DAOException, VersionException;
	
	/**
	 * Update an {@link PhoneNumber}.
	 * @param id
	 * @param version 
	 * @param phoneKind
	 * @param phoneNumber
	 * @param contact
	 * @return the {@link PhoneNumber} updated.
	 * @throws {@link DAOException}
	 * @throws {@link VersionException}
	 */
	public PhoneNumber updatePhoneNumber(int id, long version, String phoneKind,
			String phoneNumber, Contact contact) throws DAOException, VersionException;
	
	/**
	 * Delete an {@link PhoneNumber} from the database.
	 * @param id the id of the {@link PhoneNumber} to delete.
	 * @return false if the delete fail, true otherwise.
	 * @throws {@link DAOException}
	 */
	public boolean deletePhoneNumberDB(int id) throws DAOException;
}
